<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">

    <title>无限极创新资讯分享后台</title>
    <link href="images/style.css" rel="stylesheet" type="text/css" />
    <script src="http://cdn.bootcss.com/jquery/2.1.3/jquery.min.js"></script>
    <script src="js/layer/layer.js"></script>

</head>
    
<body>     
    <div id="rss-wrap">
        <div class="button">新增RSS</div>
        <div class="title">RSS列表</div>
        <div class="table">
            <div class="head">
               <li class="checkbox"></li>
               <li class="adress">地址名称</li>
               <li class="rssadr">RSS地址</li>
               <li class="setup">操作</li>
            </div>
           <!--  <div class="detail">
               <li class="checkbox">
                    <input type="checkbox">
                </li>
               <li class="adress">恒拓开源</li>
               <li class="rssadr">http://www.htky.com</li>
               <li class="setup">
                 <div class="show">
                   请选择
                 </div>
                 <select class="selectbox">
                   <option selected value="">请选择</option>
                   <option value="1">1</option>
                   <option value="2">2</option>
                   <option value="3">3</option>
                   <option value="4">4</option>
                 </select>
               </li>
            </div> -->
        </div>
        <div class="foot">          
            <input type="checkbox" class="istrue" id="all" />
            <label for="all">全选</label>
            <span class="delect">批量删除</span>
            <div class="page">
              <img src="images/qiehuan1.png" alt="">
              <span>1/1</span>
              <img src="images/qiehuan2.png" alt="">
            </div>
        </div>
    </div>
</body>

<script>
	$(function(){

       //表格内容
       for(var i=0;i<11;i++){
          var str='<div class="detail">'+
                  '<li class="checkbox">'+
                    '<input type="checkbox">'+
                '</li>'+
               '<li class="adress">恒拓开源</li>'+
               '<li class="rssadr">http:\/\/www.htky.com</li>'+
               '<li class="setup">'+
                 '<div class="show">请选择</div>'+
                 '<select class="selectbox">'+
                   '<option selected value="">请选择</option>'+
                   '<option value="1">1</option>'+
                   '<option value="2">2</option>'+
                   '<option value="3">3</option>'+
                   '<option value="4">4</option>'+
                 '</select>'+
               '</li>'+
               '</div>';
          $('.table').append(str);
        }


        //全选按钮
       $("#all").on("click",function(){
        //console.log($(".checkbox").length);
       var pan= $(this).hasClass("istrue");
       if(pan){
        $(this).removeClass("istrue");
        $(".checkbox").find("input").prop("checked",true);
       }
       else{
        $(this).addClass("istrue");
        $(".checkbox").find("input").prop("checked",false);
       }
       });

       //模拟下拉框
       function select(){
          $(".setup .selectbox").change(function(e){
              var thisval=$(e.currentTarget).val();
              $(this).parent().find(".show").text(thisval);
          });
       }
       select();
       
        //删除功能
       $('.delect').on("click",function(){
          $(".detail").each(function(){
              var check=$(this).find("input[type='checkbox']");
              if($(check)[0].checked){
                $(this).remove();
              } 
          })
       });

       //新增RSS
       var rssadd="";
       var rssname="";
       $(".button").on("click",function(){

        layer.open({
            type: 2,
            title: "新增RSS地址池",
            closeBtn: 2,
            shadeClose: true,
            shade: 0.8,
            area: ['50%', '200px'],
            content: 'layerpage/addRss.html', //iframe的url   
            
            success: function(layero, index){
                var body = layer.getChildFrame('body', index);
                // console.log(body.html()) //得到iframe页的body内容
                // body.find('input').val('Hi，我是从父页来的')
                $(body).find(".rssadd").on("input",function(){
                  rssadd=$(this).val();
                });
                $(body).find(".rssname").on("input",function(){
                  rssname=$(this).val();
                });
              },

            end:function(){
              console.log(rssadd,rssname);    
              var str='<div class="detail">'+
                  '<li class="checkbox">'+
                    '<input type="checkbox">'+
                '</li>'+
               '<li class="adress">'+rssname+'</li>'+
               '<li class="rssadr">'+rssadd+'</li>'+
               '<li class="setup">'+
                 '<div class="show">请选择</div>'+
                 '<select class="selectbox">'+
                   '<option selected value="">请选择</option>'+
                   '<option value="1">1</option>'+
                   '<option value="2">2</option>'+
                   '<option value="3">3</option>'+
                   '<option value="4">4</option>'+
                 '</select>'+
               '</li>'+
               '</div>';
               $('.table').append(str);  

                //模拟下拉框
               select(); 


            }
  
        });


       })
      

    })
</script>

</html>


